﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AFCEPF.BankApplication.BLL
{
    public abstract class Employee : Person, IRequestApprover<RequestBase>
    {
        
        public abstract double  GetMaximumAmountForApproval();

        protected IRequestApprover<RequestBase> _successor;

        #region -- IRequestApprover<Request> Members --

       


        public void SetSuccessor(IRequestApprover<RequestBase> approver)
        {
            _successor = approver;
        }

        public virtual void ProcessRequest(RequestBase request)
        {
            if (request.Amount < GetMaximumAmountForApproval())
            {
                request.Approved = true;
            }
            else
            {
                _successor.ProcessRequest(request);
            }
        }

        #endregion

    }

   
}
